package com.pomelo.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.*;
import java.util.Properties;

public class FileConfig {

    /*
     * 加载配置文件
     */
    static {
        File file = new File("E:/home/config/application.properties");

        InputStream resource = null;
        try {
            resource = new FileInputStream(file);
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }
        Logger logger = LoggerFactory.getLogger(FileConfig.class);
        Properties properties = new Properties();
        try {
            properties.load(resource);
        } catch (IOException e) {
            logger.error(e.getMessage());
        }
        FileConfig.ip = properties.getProperty("ip");
        FileConfig.user = properties.getProperty("user");
        FileConfig.password = properties.getProperty("password");
        FileConfig.path = properties.getProperty("path");
        FileConfig.port = properties.getProperty("port");
        FileConfig.downloadPath = properties.getProperty("downloadPath");
        logger.info("配置加载完毕");
    }
    private static String ip;
    private static String user;
    private static String password;
    private static String port;
    private static String path;
    private static String downloadPath;

    public static String getIp() {
        return ip;
    }

    public static String getUser() {
        return user;
    }

    public static String getPassword() {
        return password;
    }

    public static String getPort() {
        return port;
    }

    public static String getPath() {
        return path;
    }

    public static String getDownloadPath() {
        return downloadPath;
    }

}
